package com.example.video_module;

import android.view.LayoutInflater;
import android.view.View;

import com.example.adapter_sdk.quick.BaseQuickMoreAdapter;
import com.example.adapter_sdk.quick.BaseViewHolder;

public class VideoAdapter extends BaseQuickMoreAdapter<VideoEntity.DataBean.VideoData> {


    @Override
    public void convert(BaseViewHolder holder, VideoEntity.DataBean.VideoData item) {

        switch (item.itemType){
            case 0:{
//                addItemChildClick(R.id.like);
//                addItemChildClick(R.id.item_video_txt_head);
//                addItemChildClick(R.id.diss);
//                addItemChildClick(R.id.comment);
//                addItemChildClick(R.id.share);
                holder.setCircleImage(R.id.item_video_txt_head,item.author.avatar);
                holder.setText(R.id.item_video_txt_name,item.author.name);
                holder.setText(R.id.item_video_txt_intro,item.feeds_text);
                holder.setText(R.id.item_video_txt_background,item.activityText);
            }break;
            case 1:{
//                addItemChildClick(R.id.like);
//                addItemChildClick(R.id.diss);
//                addItemChildClick(R.id.comment);
//                addItemChildClick(R.id.share);
                holder.setCircleImage(R.id.item_video_pic_head,item.author.avatar);
                holder.setText(R.id.item_video_pic_name,item.author.name);
                holder.setText(R.id.item_video_pic_intro,item.feeds_text);
                holder.setImage(R.id.item_video_pic_background,item.cover);
            }break;
            case 2:{
//                addItemChildClick(R.id.like);
//                addItemChildClick(R.id.diss);
//                addItemChildClick(R.id.comment);
//                addItemChildClick(R.id.share);
                holder.setCircleImage(R.id.item_video_txt_head,item.author.avatar);
                holder.setText(R.id.item_video_video_name,item.author.name);
                holder.setText(R.id.item_video_video_intro,item.feeds_text);
                holder.setIjk(R.id.item_video_video_background,item.url,item.cover);
            }break;
        }
    }

    @Override
    protected View createItemView(int viewType) {
        if (viewType==0){
            View item_text = LayoutInflater.from(context).inflate(R.layout.video_item_text,null,false);
            return item_text;
        }else if (viewType==1){
            View item_pic = LayoutInflater.from(context).inflate(R.layout.video_item_pic,null,false);
            return item_pic;
        }else{
            View item_video = LayoutInflater.from(context).inflate(R.layout.video_item_video,null,false);
            return item_video;
        }
    }

    @Override
    public int getItemType(int position) {
        return getData().get(position).itemType;
    }
}
